package cn.tedu.javaadminly.demo.util;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@Slf4j
public class Result<T> {
    private int code;
    private String msg;
    private T data;

    public static <T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.setCode(2000);
        result.setMsg("success");
        result.setData(data);
        return result;
    }


    public static Result<String> error(int i, String s) {
        Result<String> result = new Result<>();
        result.setCode(i);
        result.setMsg(s);
        result.setData(null);
        return result;
    }
}
